//
//  JXStatus.swift
//  01-weiboSwift
//
//  Created by TwistFate on 16/3/2.
//  Copyright © 2016年 TwistFate. All rights reserved.
//

import UIKit

class JXStatus: NSObject {

    //微博创建时间
    var created_at :String?
    
    //微博ID
    var id:Int64 = 0
    
    //微博信息内容
    var text:String?
    
    //微博来源
    var source:String?
    
    //转发数
    var reposts_count:Int = 0
    
    //评论数
    var comments_count:Int = 0
    
    //表态数
    var attitudes_count:Int = 0
    
    //微博配图数组里面放的是字典
    var pic_urls:[[String : AnyObject]]?
    
    //
    var user : JXUser?
    
    
    init(dict:[String : AnyObject]){
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user" {
            if let dict = value as? [String:AnyObject] {
                user = JXUser(dict: dict)
            }
            return
        }
        
        super.setValue(value, forKey: key)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    override var description: String {
        // 当计算性属性只有get方法时,可以省略
        //        get {
        //        }
        let key = ["created_at", "id", "text", "source","reposts_count","comments_count","attitudes_count","pic_urls","user"]
        
        return "\n\t微博模型: \(dictionaryWithValuesForKeys(key).description)"
    }
    
}
